Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug t radiative #2560

Merged
merged 15 commits into from
May 10, 2024
Merged

Bug t radiative #2560

merged 15 commits into from
May 10, 2024

Conversation

Sumit112192
Copy link
Contributor

@Sumit112192 Sumit112192 commented Mar 23, 2024

📝 Description

Type: 🪲 bugfix| memo: documentation
image
ref. https://tardis-sn.github.io/tardis/physics/setup/model.html#Temperatures

lambda_wien_inner = const.b_wien / packet_source.temperature
t_radiative = const.b_wien / (
lambda_wien_inner
* (1 + (geometry.v_middle - geometry.v_inner_boundary) / const.c)
)
return t_radiative

The code doesn't match with the documentation. So, I have changed it accordingly.
I have directly used packet_source.temperature rather than first computing lambda_wien_inner

Slight documentation typos:
The documentation string of parse_structure_config was repeated twice, so I removed the extra one.
Also, there were some instances where v_inner, v_outer were labeled as r_inner, r_outer. So, I have changed them as well.

Also, If we pass packet_source as one of the function arguments, why define it again in the body?

def initialize_packet_source(config, geometry, packet_source):
"""
Initialize the packet source based on config and geometry
Parameters
----------
config : Config
The configuration object containing the supernova and plasma settings.
geometry : Geometry
The geometry object containing the inner radius information.
packet_source : BasePacketSource
The packet source object based on the configuration and geometry.
Returns
-------
packet_source : BasePacketSource
The packet source object based on the configuration and geometry.
Raises
------
ValueError
If both t_inner and luminosity_requested are None.
"""
if config.montecarlo.enable_full_relativity:
packet_source = BlackBodySimpleSourceRelativistic(
base_seed=config.montecarlo.seed,
time_explosion=config.supernova.time_explosion,
)
else:
packet_source = BlackBodySimpleSource(base_seed=config.montecarlo.seed)

📌 Resources

Examples, notebooks, and links to useful references.

🚦 Testing

How did you test these changes?

  • Testing pipeline
  • Other method (describe)
  • My changes can't be tested (explain why)

☑️ Checklist

  • I requested two reviewers for this pull request
  • I updated the documentation according to my changes
  • I built the documentation by applying the build_docs label

Note: If you are not allowed to perform any of these actions, ping (@) a contributor.
@andrewfullard @jamesgillanders Please review this pull request.

lambda_wien_inner
* (1 + (geometry.v_middle - geometry.v_inner_boundary) / const.c)
t_radiative = packet_source.temperature / (
(1 - (geometry.v_middle - geometry.v_inner_boundary) / const.c)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation is incorrect here: the 1 - should be 1 + because temperature should decrease further out. The other change (packet_source.temperature) is fine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can modify the documentation to fix the sign of the function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes !!! That makes sense. I will change the documentation and will redo this change to the original.

@DeerWhale
Copy link
Contributor

Thanks for spotting the duplication of the packet initialization, I have opened an issue #2585 and our team members will look into this further. Feel free to dive deeper if you are interested as well!

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@Sumit112192
Copy link
Contributor Author

@andrewfullard I have made the necessary changes.

The changes that I have made till now.

  1. Updated the documentation so that doppler factor is $1+\frac{\Delta v}{v}$ instead of $1-\frac{\Delta v}{v}$
  2. Fixed some common typos in the documentation strings of the functions
  3. Change suggested by Black in the file tardis/model/parse_input.py

@Sumit112192
Copy link
Contributor Author

I don't know why Black's test is failing on tardis/model/parse_input.py, but I have made the change that Black suggested.

image

@Sumit112192
Copy link
Contributor Author

It seems that the suggestions by black installed through sudo apt install black on Ubuntu are different from those of black installed through pip install black.

@Sumit112192
Copy link
Contributor Author

Sorry for all those commits. I am still trying to figure out how branching works in Git, and hopefully, I will not repeat the same mistake.

Copy link

codecov bot commented May 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.18%. Comparing base (ea5a1bf) to head (a0f2dad).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2560      +/-   ##
==========================================
- Coverage   67.18%   67.18%   -0.01%     
==========================================
  Files         173      173              
  Lines       14570    14569       -1     
==========================================
- Hits         9789     9788       -1     
  Misses       4781     4781              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andrewfullard
Copy link
Contributor

It seems that the suggestions by black installed through sudo apt install black on Ubuntu are different from those of black installed through pip install black.

Make sure you use the version of black that is installed with the TARDIS environment

@andrewfullard andrewfullard self-requested a review May 3, 2024 12:28
@tardis-bot
Copy link
Contributor

*beep* *bop*

Hi, human.

The docs workflow has succeeded ✔️

Click here to see your results.

@andrewfullard andrewfullard requested a review from DeerWhale May 8, 2024 17:47
@andrewfullard andrewfullard enabled auto-merge (squash) May 10, 2024 14:12
@andrewfullard andrewfullard merged commit 8d70aaa into tardis-sn:master May 10, 2024
13 checks passed
@Sumit112192 Sumit112192 deleted the Bug_T_radiative branch May 10, 2024 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants